# 将单词过滤成单独的单词
import re


def filter_words():
    with open('/Users/mengxing/Desktop/words.txt', 'r') as f:
        words = f.read()
        pattern = re.compile(r'\n(.*)? \[')
        words_list = pattern.findall(words)
        with open('/Users/mengxing/Desktop/core500_words.txt', 'w') as file:
            file.write(str(words_list))
        print(words_list)

if __name__ == '__main__':
    filter_words()
